import Hom from "../page/home/Hom";
import Sd from "../page/sd/Sd";
import Login from "../page/login/Login";
import AIChat from "../components/AIChat";
import Sp from "../components/Sp"; // 导入 Sp 组件
import ProtectedRoute from "../components/ProtectedRoute"; // 导入 ProtectedRoute 组件

const router = [
    {
        path: '/',
        element: <ProtectedRoute allowedRoles={['admin', 'user']}><Hom /></ProtectedRoute> // 保护 Hom 组件
    },
    {
        path: '/sd',
        element: <ProtectedRoute allowedRoles={['admin']}><Sd /></ProtectedRoute> // 保护 Sd 组件，仅限 admin 访问
    },
    {
        path: '/login',
        element: <Login/>
    },
    {
        path: '/ai-chat',
        element: <ProtectedRoute allowedRoles={['admin', 'user']}><AIChat /></ProtectedRoute> // 保护 AIChat 组件
    },
    {
        path: '/sp',
        element: <Sp/> // Sp 组件不进行保护
    }
]
export default router